// import { createElement } from "react";
import type { RouteConfig } from "@yaf/router";

import EnumRouter from "./EnumRouter";
import { getEnv } from "./EnumEnv";
// import { t } from "@/locale";

import { systemRoutes } from "@/components/app/sys";
// import { IconWindElement } from "@/icon"

/**
 * 获取应用系统的路由
 */
export const getAppRoutes = () => {
  const env = getEnv();
  const urlParams = new URLSearchParams(window.location.search)

  const appRoutes: RouteConfig[] = [
    {
      path: EnumRouter.login,
      component: import("@/components/app/sys/pages/login"),
    },

    {
      path: EnumRouter.appRoot,
      component: require("@/layouts/MainLayout").default,
      isLayout: true,
      props: Object.assign({
        title: env.app.title || "AIOT-SYSTEM",
        logo: env.app.logo,
        splitMenus: true,       // 注意：当layout为"side"|"top"时，需要设置为false, 当layout为"mix"时，需要设置为true
        layout: "mix",          // "side" | "top" | "mix"
        fixedHeader: true,
        fixSiderbar: true,
        navTheme: "dark",       // "light" | "dark"
        isShowLogo: true,       // 是否显示logo和标题
        isShowTopHeader: true,  // 是否显示头部
        pure: env.app.pure || (urlParams.get("pure") === "true" ? true : false),            // 是否去掉不渲染
      }),
      children: [
        systemRoutes,
      ],
    },
  ];

  return appRoutes;
}




